package com.hongning.railway.ui.main.fragments.college.itemviewModel;

import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;

import com.hongning.railway.app.Constant;
import com.hongning.railway.entity.resbean.ResExamItem;
import com.hongning.railway.ui.main.fragments.college.exam.ExamDetailFragment;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class ExamVipItemViewModel extends MultiItemViewModel {
    public ObservableField<ResExamItem> data = new ObservableField<>();
    public ObservableField<String> numperson = new ObservableField<>();
    public ObservableInt newvisiable = new ObservableInt(View.GONE);
    public BindingCommand mBindingCommand = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putParcelable(Constant.EXTRA_DATA,data.get());
            viewModel.startContainerActivity(ExamDetailFragment.class.getCanonicalName(),bundle);
        }
    });
    public ExamVipItemViewModel(@NonNull BaseViewModel viewModel,ResExamItem resdata) {
        super(viewModel);
        data.set(resdata);
        numperson.set(String.format("%d人已完成",data.get().getPronum()));
        if ("NEW".equals(resdata.getReserved())){
            newvisiable.set(View.VISIBLE);
        }else {
            newvisiable.set(View.GONE);
        }

    }
}
